package oop4.graph01;

public class Circle extends Graph {
    //静态常量一般是大写，一般常量仍然小写开头，遵守驼峰规则
    public static final double PI = 3.14; //final常量无法修改，故权限设为public
    private double r;

    public Circle(double r) {
        this.r = r;
    }

    public double getR() {
        return r;
    }

    public void setR(double r) {
        this.r = r;
    }

    @Override
    public double calcArea() {
        return PI * r * r;
    }

    @Override
    public double calcRound() {
        return 2 * PI * r;
    }

    @Override
    public String toString() {
        return "这是一个圆，半径是" + r;
    }
}
